import request from '@/utils/request'

//注册接口
export const userRegisterService = (params) => {
    const data = new URLSearchParams();
    for (let key in params) {
        data.append(key, params[key]);
    }
    return request.post('/user/register', data);
}

//登录接口
export const userLoginService = (params) => {
    const data = new URLSearchParams();
    for (let key in params) {
        data.append(key, params[key]);
    }
    return request.post('/user/login', data);
}

//获取个人信息
export const userInfoGetService = ()=>{
    return request.get('/user/userInfo');
}

// 修改个人信息
export const updateUserInfo = (data) =>{
    return request.put("/user/update",data)
}

//修改头像
export const userAvatarUpdateService=(avatarUrl)=>{
    let params = new URLSearchParams();
    params.append('avatarUrl',avatarUrl)
    return request.patch('/user/updateAvatar',params)
}

// 修改密码
export const userResetPassword = (data) =>{
    return request.patch("/user/updatePwd",data)
}